/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cl.bussines.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Vogel
 */
@Entity
@Table(name = "insumos")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Insumos.findAll", query = "SELECT i FROM Insumos i"),
    @NamedQuery(name = "Insumos.findByIdInsumos", query = "SELECT i FROM Insumos i WHERE i.idInsumos = :idInsumos"),
    @NamedQuery(name = "Insumos.findByCantidad", query = "SELECT i FROM Insumos i WHERE i.cantidad = :cantidad")})
public class Insumos implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_Insumos")
    private Integer idInsumos;
    @Column(name = "Cantidad")
    private Integer cantidad;
    @JoinColumn(name = "Cod_Prod", referencedColumnName = "Cod_Prod")
    @ManyToOne(optional = false)
    private Productos codProd;
    @JoinColumn(name = "id_Operaciones", referencedColumnName = "id_Operaciones")
    @ManyToOne(optional = false)
    private Operaciones idOperaciones;

    public Insumos() {
    }

    public Insumos(Integer idInsumos) {
        this.idInsumos = idInsumos;
    }

    public Integer getIdInsumos() {
        return idInsumos;
    }

    public void setIdInsumos(Integer idInsumos) {
        this.idInsumos = idInsumos;
    }

    public Integer getCantidad() {
        return cantidad;
    }

    public void setCantidad(Integer cantidad) {
        this.cantidad = cantidad;
    }

    public Productos getCodProd() {
        return codProd;
    }

    public void setCodProd(Productos codProd) {
        this.codProd = codProd;
    }

    public Operaciones getIdOperaciones() {
        return idOperaciones;
    }

    public void setIdOperaciones(Operaciones idOperaciones) {
        this.idOperaciones = idOperaciones;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idInsumos != null ? idInsumos.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Insumos)) {
            return false;
        }
        Insumos other = (Insumos) object;
        if ((this.idInsumos == null && other.idInsumos != null) || (this.idInsumos != null && !this.idInsumos.equals(other.idInsumos))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "cl.bussines.entities.Insumos[ idInsumos=" + idInsumos + " ]";
    }
    
}
